use scraper::{Html, Selector};
fn main() {
    let html = r#"
        <div class="f">
            <ul id="ul">
                <li>
                    <a href="fh">这是a标签1</a>
                </li>                    
                <li>
                    <a href="fh">这是a标签2</a>
                </li>       
                <li>
                    <a href="fh">这是a标签3</a>
                </li>       
                <li>
                    <a href="fh">这是a标签4</a>
                </li>       
                <li>
                    <a href="fh">这是a标签5</a>
                </li>      
                <li>
                    <a  >这是a标签6</a>
                </li>    
            </ul></div> 
    "#;
    let fragment = Html::parse_document(html);
    let get_li = Selector::parse("ul li a");
    match get_li {
        Ok(ref o) => {
            for emement in fragment.select(&o) {
                let href = emement.value().attr("href");
                if href != None {
                    println!("{}", href.unwrap());
                }
            }
        }
        Err(_) => {}
    }
}
